﻿
Imports storoomc

Public Class storoomDelegate
    Inherits Global.requestProcessor

    Public Const _pathidentity As String = "__INVALID_PATH__"

    Public Overrides Function pathidentity() As String
        Return _pathidentity
    End Function

    Public Overrides Sub initial(Optional ByVal config As configParser = Nothing)
        assert(Not config Is Nothing, "conver.storoomDelegate should be initialized with a valid configuration.")
        MyBase.initial(config)

        Dim host As String = Nothing
        Dim port As Int32 = 0
        Dim retrytimes As Int64 = 0
        host = config.parameter(configNaming.storoom.name, configNaming.storoom.storoomhost, _
                                configNaming.defaultValue.storoom.storoomhost)
        port = config.parameter(configNaming.storoom.name, configNaming.storoom.storoomport, _
                                configNaming.defaultValue.storoom.storoomport)
        retrytimes = config.parameter(configNaming.storoom.name, configNaming.storoom.storoomretrytimes, _
                                      configNaming.defaultValue.storoom.storoomretrytimes)
        storoom = storoomTalks.get(host, port)
    End Sub

    Public Overrides Function process(ByVal context As httpContext) As Boolean
        If Not context Is Nothing Then
            context.setstatuscode(Net.HttpStatusCode.NoContent, "NOCONTENT")
        Else
            debugassert(False, "context is nothing.")
        End If

        Return True
    End Function
End Class
